main: Add U-Boot bootlader backend support
authorJavier Martinez Canillas <javier.martinez@collabora.co.uk>
Thu, 15 Aug 2013 10:33:25 +0000 (12:33 +0200)
committerColin Walters <walters@verbum.org>
Tue, 20 Aug 2013 17:00:46 +0000 (13:00 -0400)
commit750a60d3aa35749700f55f53e43beff623ecbf9b
tree1320d086bf9e06b6e6874900fc3d29dcaa481395
parentcf14b398da3a28eb8d13d5fb1ca88a489a5df000
main: Add U-Boot bootlader backend support

This patch adds support to generate files that
can be used by Universal Bootloader (U-Boot).

U-Boot allows to modify boards default boot commands by
reading and executing a bootscript file or importing a
plain text file that contains environment variables that
could parameterize the boot command or a bootscript.

OSTree generates a uEnv.txt file that contains booting
information that is taken from Boot Loader Specification
snippets files as defined in the new OSTree deployment model:

https://wiki.gnome.org/OSTree/DeploymentModel2

On deploy or upgrade an uEnv.txt env var file is created
in the path /boot/loader.${bootversion}/uEnv.txt. Also, a
/boot/uEnv.txt symbolic link to loader/uEnv.txt is created
so U-Boot can always import the file from a fixed path.

Since U-Boot does not support a menu to list a set of
Operative Systems, the most recent bootloader configuration
from the list is used.

To boot an OSTree using the generated uEnv.txt file, a
board has to parameterize its default boot command using the
following variables defined by OSTree:

${kernel_image}:  path to the Linux kernel image
${ramdisk_image}: path to the initial ramdisk image
${bootargs}:      parameters passed to the kernel command line

Alternatively, for boards that don't support this scheme,
a bootscript that overrides the default boot command can be used.

An example of such a bootscript could be:

setenv scriptaddr 40008000
setenv kernel_addr 0x40007000
setenv ramdisk_addr 0x42000000
ext2load mmc 0:1 ${scriptaddr} uEnv.txt
env import -t ${scriptaddr} ${filesize}
ext2load mmc 0:1 ${kernel_addr} ${kernel_image}
ext2load mmc 0:1 ${ramdisk_addr} ${ramdisk_image}
bootm ${kernel_addr} ${ramdisk_addr}

Signed-off-by: Javier Martinez Canillas <javier.martinez@collabora.co.uk>
https://bugzilla.gnome.org/show_bug.cgi?id=706370
Makefile-ostree.am
src/ostree/ot-admin-functions.c
src/ostree/ot-bootloader-uboot.c [new file with mode: 0644]
src/ostree/ot-bootloader-uboot.h [new file with mode: 0644]